home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / dev / misc / ImageFXDevKit.lha / sdev / include / scan / loadsave.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-22  |  6.0 KB  |  174 lines

  1. /*
  2.  * Scan 'C' Header File
  3.  * Written by Thomas Krehbiel
  4.  *
  5.  * Loaders/savers.
  6.  *
  7.  */
  8.  
  9. #ifndef SCAN_LOADSAVE_H
  10.  
  11.  
  12. #ifndef EXEC_TYPES_H
  13. #include <exec/types.h>
  14. #endif
  15.  
  16. #ifndef EXEC_NODES_H
  17. #include <exec/nodes.h>
  18. #endif
  19.  
  20. #ifndef EXEC_LISTS_H
  21. #include <exec/lists.h>
  22. #endif
  23.  
  24. /* why is this here?  becuase render modules usually include loadsave.h */
  25. #ifndef SCAN_REND_H
  26. #include <scan/rend.h>
  27. #endif
  28.  
  29.  
  30. /************************************************************************
  31.  * The loader passes back an array of these structures to identify
  32.  * what kinds of files it can load.  The end of the array is signified
  33.  * by a NULL Identifier field.  The Identifier is a string of bytes that
  34.  * must be matched at the beginning of the file, for Length bytes.
  35.  */
  36.  
  37. struct LoadFormat {
  38.    char    *Identifier;             /* Variable-length identifier bytes */
  39.    int      Length;                 /* Length of identifier string */
  40.    char    *Name;                   /* Name of format (for user) */
  41.    int      ID;                     /* Loader-specific ID code */
  42.    UWORD    Flags;                  /* Various flags (see below) */
  43. };
  44.  
  45. /* flags for LoadFormat: */
  46. #define LOA_NOFILE   (0x0200)       /* Tell ImageFX not to ask for filename
  47.                                        when loading this format - this is
  48.                                        used by the clipboard loader */
  49.  
  50. #define LOA_MULTI    (0x1000)       /* This file format contains multiple
  51.                                        images (eg. animation) - used to
  52.                                        determine whether a file is an
  53.                                        animation or not. */
  54.  
  55. /*
  56.  * A list of these is maintained by Image Scan.
  57.  */
  58.  
  59. struct LoadNode {
  60.    struct Node       Node;          /* Exec-standard node */
  61.    struct LoadFormat Format;        /* Format information */
  62.    char              Loader[128];   /* Loader to open and call */
  63.    int               Bytes;         /* Length of node in bytes */
  64.    char              Name[60];      /* Name of the loader */
  65.    char              Text[1];       /* Text is allocated here */
  66. };
  67.  
  68. struct LoadList {
  69.    struct List       List;          /* List of loader nodes */
  70.    int               MaxLength;     /* Bytes to read from file */
  71. };
  72.  
  73.  
  74. /*
  75.  * The saver simply passes back an array of string pointers which
  76.  * indicate the names of the various "flavors" of the particular
  77.  * file format the saver handles.  The list is terminated by a
  78.  * NULL String.
  79.  *
  80.  * For example, an ILBM saver might pass back the strings:
  81.  *
  82.  *       "ILBM (standard)"
  83.  *       "ILBM (with XBMI)"
  84.  */
  85.  
  86. struct SaveFormat {
  87.    char             *Name;
  88.    ULONG             Flags;
  89.    int               ID;
  90. };
  91.  
  92. /* flags for SaveFormat: */
  93. #define SAV_TRUE     (0x0001)       /* Can save 8- or 24-bit true color */
  94. #define SAV_MAPPED   (0x0002)       /* Can save a BitMap/ViewPort */
  95. #define SAV_PALETTE  (0x0004)       /* Can save a 24-bit palette */
  96. #define SAV_CMYK     (0x0008)       /* Can handle CMYK format images */
  97. #define SAV_NOREQ    (0x0080)       /* Don't ask to overwrite... we'll do it */
  98. #define SAV_NOMASK   (0x0100)       /* Format does not support a mask */
  99. #define SAV_NOFILE   (0x0200)       /* This format does not require a filename (eg. clipboard) */
  100. #define SAV_NOICON   (0x0400)       /* Do not save an icon with this file */
  101. #define SAV_NOPIC    (0x0800)       /* Format does not require a render picture */
  102. #define SAV_MULTI    (0x1000)       /* Format contains multiple images (ie. anim) */
  103.  
  104. struct SaveNode {
  105.    struct MinNode    Node;          /* Exec standard node */
  106.    struct Node       TrueNode;      /* Node for True list */
  107.    struct Node       MappedNode;    /* Node for Mapped list */
  108.    struct Node       PalNode;       /* Node for Palette list */
  109.    struct Node       SepNode;       /* Node for Color Separation list */
  110.    struct SaveFormat Format;        /* Save format name */
  111.    char              Saver[128];    /* Name of saver module */
  112.    int               Bytes;         /* Length of node in bytes */
  113.    char              Text[1];       /* Text is allocated here */
  114. };
  115.  
  116. /*
  117.  * Palette() - A 24-bit color palette to save.
  118.  */
  119.  
  120. struct Palette {
  121.    short             Depth;         /* Bitplanes in palette */
  122.    short             Count;         /* Count of palette entries, will
  123.                                        usually be 2 ^ Depth */
  124.    UBYTE            *Table;         /* Array of palette entries, arranged
  125.                                        as 3 bytes each of Red, Green,
  126.                                        Blue. */
  127.    short             NumRanges;     /* Number of color ranges in palette */
  128.    short             pad0;
  129.    short            *LowRange;      /* Array of lower limit of ranges */
  130.    short            *HighRange;     /* Array of upper limit of ranges */
  131.    short            *RangeLocked;   /* Array of locked indicators */
  132. };
  133.  
  134. /*
  135.  * MappedImage - This is passed to the Saver module SM_SaveMapped()
  136.  *               function to write out a mapped image.
  137.  */
  138.  
  139. struct MappedImage {
  140.    short             Width;         /* True image pixel width */
  141.    short             Height;        /* True image pixel height */
  142.    struct BitMap    *BitMap;        /* Image bitmap, up to 8 bitplanes */
  143.    struct ViewPort  *ViewPort;      /* Obsolete - set to NULL */
  144.    UBYTE            *Copper;        /* Palette for each scanline (UNUSED) */
  145.    struct Palette    Palette;       /* True image palette, see above */
  146.    ULONG             Modes;         /* ViewModes - use instead of ViewPort */
  147.    UWORD             AspectX,       /* X & Y pixel aspect ratio */
  148.                      AspectY;       /* (used to fill in BMHD) */
  149.    ULONG             pad[7];        /* reserved */
  150. };
  151.  
  152. /*
  153.  * FileStats - structure a loader can fill in containing basic
  154.  * information about a file.
  155.  *
  156.  * (UNUSED)
  157.  *
  158.  */
  159. struct FileStats {
  160.    ULONG    Flags;
  161.    LONG     Width, Height, Depth;   /* depth in BITPLANES */
  162.    WORD     AspectX, AspectY;
  163.    WORD     DPIX, DPIY;
  164.    LONG     reserved[4];
  165. };
  166.  
  167. #define FS_UNKNOWN   (-1)
  168.  
  169. #define FSF_MULTI    0x0001      /* Multiple "frames" */
  170.  
  171.  
  172. #define SCAN_LOADSAVE_H
  173. #endif
  174.